﻿using System.Collections.Generic;
using System.Linq;
using OpenWaves.EPiServer.Localization.Model;

namespace OpenWaves.EPiServer.Localization.Transformations
{
    public partial class StaticTranslationKeysTemplate
    {
        private readonly TranslationModel model;

        public StaticTranslationKeysTemplate(IEnumerable<string> filePaths)
            : this(filePaths, true)
        {
        }

        public StaticTranslationKeysTemplate(IEnumerable<string> filePaths, bool excludeDefaultFiles)
        {
            if (excludeDefaultFiles)
            {
                filePaths = filePaths.Where(p => TranslationKeysTemplate.IsDefaultFile(p) == false);
            }

            this.model = TranslationModel.FromFiles(filePaths);
        }

        public StaticTranslationKeysTemplate(TranslationModel model)
        {
            this.model = model;
        }

        public int EPiServerVersion
        {
            get { return this.model.EPiServerVersion; }
            set { this.model.EPiServerVersion = value; }
        }

        public TranslationModel Model
        {
            get { return this.model; }
        }
    }
}